< previous page page_129 next page >

Page 129
(sometimes called an OCX control) that can be used in any ActiveX-compliant developer tool. You can use this control in Visual Basic (versions 4 and 5), C++, Access, and, in most cases, Microsoft Internet Explorer.
To create a new custom control, select File | New Project from the main menu and then select ActiveX Control from the list of default templates (see Figure 5.9).
0129-01.jpg
Figure 5.9.
Opening a Visual Basic BAS module.
Set the Name property of the UserControl module to VText (validated textbox) and set the project name to CustomValidation. Create a new directory for this project called CustomValidation. Save the UserControl file as VTEXT.CTL and the project as CUSTOMERVALIDATION.VBP. This is the framework for creating your custom validation control.
Creating a custom control is really easy. You need to build four primary sets of routines for a custom control:
· Properties
· Methods
· Events
· Maintenance routines
Although the first three types of code routines are fairly obvious, the fourth, maintenance routines, are new. When you create an ActiveX control, you need to write code that manages the setting and retrieving of property values during both design time and runtime. To do this, you need to write a few short routines to keep track of all the property settings for your control. You learn how to code each of these types of routines as you build your validation textbox.

 
< previous page page_129 next page >

If you like this book, buy it!